package com.example.smartcity_poverty.ui.AllService.PetHospital.adapter

import android.content.Intent
import com.example.smartcity_poverty.App.Companion.url
import com.example.smartcity_poverty.Base.BaseRecyclerAdapter
import com.example.smartcity_poverty.logic.ServiceBean.PetHospitalBean.PhMeListAllModel
import com.example.smartcity_poverty.logic.util.Util.glide
import com.example.smartcity_poverty.ui.AllService.PetHospital.activity.PhMeShowActivity
import kotlinx.android.synthetic.main.re_ph_me_list.*

/**
 *  created by ikun
 *  ANDROID STUDIO - version 4.0
 *  email: jinkunwei41@gmail.com
 * --------------------------------
 *  宠物医院我的列表适配器
 **/
class PhMeListAdapter(
    val list: MutableList<PhMeListAllModel.RowsBean>,
    layoutId: Int
) : BaseRecyclerAdapter<PhMeListAllModel.RowsBean>(list, layoutId) {
    override fun setData(
        view: BaseViewHolder.ViewFind,
        data: PhMeListAllModel.RowsBean,
        position: Int,
        holder: BaseViewHolder
    ) {
        val d = list[position]
        val con = holder.viewFind.view?.context
        // 填充数据
        glide(url + d.doctor?.avatar, view.phMeListImage)
        view.phMeListName.text = d.doctor?.jobName
        view.phMeListContent.text = "描述内容: ${d.question}"

        // 点击
        holder.itemView.setOnClickListener {
            con?.startActivity(Intent(Intent(con, PhMeShowActivity::class.java).apply {
                putExtra("rows", list[position])
            }))
        }


    }
}